<% unless apps.size > 0 %>
<div class="panel panel-danger">
  <div class="panel-heading text-center">Needs an App to continute...</div>
  <form class="panel-body text-center" method="post" action="/">
    <span class="text-muted">CAUTION: this may take your 1 second or less!</span> <button type="submit" class="btn btn-primary">Create your first App</button>
  </form>
</div>
<% end %>

<div class="row">
  <div class="col-sm-8 col-sm-offset-2">
    <% apps.each do |app| %>
    <div class="panel panel-default">
      <div class="panel-heading text-center"><%= app.label %></div>
      <form class="panel-body text-center" method="post" action="/apps/<%= app.id %>" rel="delete-app">
        <input type="hidden" name="_method" value="DELETE" />
        <div class="btn-group">
          <a class="btn btn-default" href="/apps/<%= app.id %>">Details</a>
          <a class="btn btn-default" href="/apps/<%= app.id %>/test" rel="test_app">Test App</a>
          <a class="btn btn-info" href="/apps/<%= app.id %>/message">Send Messages</a>
          <button type="submit" class="btn btn-danger">Delete</button>
        </div>
        <%= app_none_url_alert app, true, true %>
      </form>
    </div>
    <% end %>

    <% if apps.size > 0 %>
    <div class="panel panel-default">
      <form class="panel-body text-center" method="post" action="/">
        <span class="text-muted">Needs another App?</span> <button type="submit" class="btn btn-default">New App</button>
      </form>
      <% if apps.size > 3 %>
      <form class="panel-body text-center" method="post" action="/" rel="delete-app">
        <input type="hidden" name="_method" value="DELETE" />
        <span class="text-muted">Want to clear all Apps?</span> <button type="submit" class="btn btn-danger">Clear all Apps</button>
      </form>
      <% end %>
    </div>
    <% end %>
  </div>
</div>
<p class="text-center text-muted">Set Api url for your wechat-app as following</p>
<p class="lead text-center text-muted"><%= uri('/api/') %></p>